{% extends "wagglyblog/base.html" %}

{% load i18n %}
{% load markup %}
{% load comments %}
{% load wagglyblog_extras %}

{% block content %}
<div class="column span-10">
    <div class="column span-5">
        {% if object.get_previous_published %}
            <span>
                <a href="{{ object.get_previous_published.get_absolute_url }}">&laquo; {% trans "previous post" %}</a>
            </span>
        {% endif %}
    &nbsp;
    </div>

    <div class="column span-5 last" style="text-align: right;">
    &nbsp;
        {% if object.get_next_published %}
            <span>
                <a href="{{ object.get_next_published.get_absolute_url }}" title="{{ object.get_next_published.titel }}">{% trans "next post" %} &raquo;</a>
            </span>
        {% endif %}
    </div>

    <h2>{{ object.title }}</h2>

    <div>{{ object.text|markdown }}</div>
</div>

<div class="column prepend-1 span-5 last">
{% get_free_comment_count for wagglyblog.post object.id as comment_count %}
    <ul class="wagglyblog-post-metadata">
        <li>{% blocktrans with object.pub_date|timesince as timesince %}{{ timesince }} ago{% endblocktrans %}</li>
        <li><a href="{{ object.get_author_url }}">{{ object.author }}</a></li>
        <li>{% if comment_count %}<a href="#comments">{% blocktrans count comment_count as comment_count %}{{ comment_count }} comment{% plural %}{{ comment_count }} comments{% endblocktrans %}</a>{% else %} {% if object.allow_comments %}{% trans "No Comments" %}{% else %}{% trans "Comments disallowed" %}{%endif %}{% endif %}</li>
        <li>{% post_category_list object.id %}</li>
        {% if perms.wagglyblog.can_edit %}<li><a href="/admin/wagglyblog/post/{{ object.id }}/">{% trans "Edit this post" %}</a></li>{% endif %}
    </ul>
</div>


{% get_free_comment_list for wagglyblog.post object.id as comments %}
{% if comments or object.allow_comments %}
<div id="comments" class="column span-15 last">
    <h2>{% trans "Discuss this text" %}</h2>
    <hr />
    <p class="box small">{% blocktrans %}Let's get the discussion started, feel free to <a href="#postform" class="click-to-slide">leave your thoughts</a> about the above post.
       You can use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> to format your comment nicely. Please be nice
       to each other and make this a happy place to be.<br />
       Rude or offensive stuff will be deleted without prior warning.{% endblocktrans %}
   </p>
   {% if object.allow_comments %}
       <div id="postform">{% free_comment_form for wagglyblog.post object.id %}</div>
   {% endif %}

        <dl>
        {% for comment in comments %}
            <dt id="c{{ comment.id }}" class="column span-3">
                <span class="person-name">{{ comment.person_name|striptags }}</span><br/>
                <p class="small quiet">{{ comment.submit_date|date }}</p>
                <a href="{{ comment.get_absolute_url }}">#</a>
            </dt>
            <dd class="column span-11 last">
                {{ comment.comment|striptags|urlize|markdown }}
            </dd>
        {% endfor %}
        </dl>
</div>
{% endif %}

{% endblock %}
